package org.example.controller;


import org.example.service.ExperimentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/experiments")
public class ExperimentController {
    @Autowired
    private ExperimentService experimentService;

    @GetMapping("/export/json/{id}")
    public ResponseEntity<String> exportExperimentStatsToJson(@PathVariable Long id) {
        String json = experimentService.exportExperimentStatsToJson(id);
        return new ResponseEntity<>(json, HttpStatus.OK);
    }

    @GetMapping("/export/csv/{id}")
    public ResponseEntity<String> exportExperimentStatsToCsv(@PathVariable Long id) {
        String csv = experimentService.exportExperimentStatsToCsv(id);
        return new ResponseEntity<>(csv, HttpStatus.OK);
    }
}